<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<script type="text/javascript">
<!--
	$(function(){
		$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
		$("#column_name").formValidator({onshow:"<?php echo L("input").L('reg_title')?>",onfocus:"<?php echo L("input").L('reg_title')?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('reg_title')?>"});
        $('#column_type').formValidator({onshow:"<?php echo L('input_column_type')?>",onfocus:"<?php echo L('input_column_type')?>",oncorrect:"<?php echo L('right_all')?>"}).inputValidator({min:1,onerror:"<?php echo L('input_column_type')?>"});		
	})
//-->
</script>
<div class="pad-lr-10">
<form action="?m=sign_up&c=reg&a=add_field" method="post" id="myform">
    <input type="hidden" name="field[table_info_id]" value="<?=$table_info_id?>">
	<table width="100%"  class="table_form">
  <tr>
    <th width="120"><?php echo L('column_name')?>：</th>
    <td class="y-bg"><input type="text" class="input-text" name="field[column_name]" id="column_name" size="30" /></td>
  </tr>
  <tr>
    <th width="120"><?php echo L('column_name_en')?>：</th>
    <td class="y-bg"><input type="text" class="input-text" name="field[column_name_en]" id="column_name_en" size="30" /></td>
  </tr>
  <tr>
    <th><?php echo L('column_image')?>：</th>
    <td class="y-bg"><?php echo form::images('field[column_image]', 'column_image', '', 'column_image', '', 30)?></td>
  </tr>
  <tr>
    <th><?php echo L('column_type')?>：</th>
    <td class="y-bg">
    	<?php echo form::select($types, $id = 0, $str = ' name="field[column_type]" id="column_type" ', '请选择')?>
    </td>
  </tr>
  <tr id="column_values" style="display:none;">
    <th><?php echo L('column_values')?>：</th>
    <td class="y-bg">
      <textarea name="field[column_values]" cols="60" rows="10" ></textarea>
    </td>
  </tr>
  <tr>
    <th><?php echo L('have_to')?>：</th>
    <td class="y-bg">
    	<?php echo form::radio($array = array('1'=>'是','2'=>'否'), 1, $str = ' name = "field[have_to]" ')?>
    </td>
  </tr>
  <tr>
    <th>是否前台显示：</th>
    <td class="y-bg">
      <?php echo form::radio($array = array('1'=>'是','0'=>'否'), 1, $str = ' name = "field[is_show]" ')?>
    </td>
  </tr>
  <tr id="is_accord_show">
    <th>是否后台统计显示：</th>
    <td class="y-bg">
      <?php echo form::radio($array = array('1'=>'是','0'=>'否'), 0, $str = ' name = "field[is_accord]" ')?>
    </td>
  </tr>
  <tr>
    <th><?php echo L('column_description')?>：</th>
    <td class="y-bg"><textarea name="field[column_description]" cols="60" rows="10" ></textarea></td>
  </tr>
</table>
<div class="bk15"></div>
    <input type="submit" class="dialog" id="dosubmit" name="dosubmit" value="<?php echo L('submit');?>" />
</form>
</div>
<script language="JavaScript">
<!--
	$("#column_type").change(function() {
		var column_type = $(this).val();
		if (column_type == 2 || column_type == 6  || column_type == 13) {
			$("#column_values").show();
		} else {
            $("#column_values").hide();
        }
	})
  $("input[name='field[is_show]']").click(function(){
    var is_show = $("input[name='field[is_show]']:checked").val();
    if (is_show == 1) {
      $('#is_accord_show').show();
    } else {
      $('#is_accord_show').hide();
    }
  })
	//-->
</script>
</body>
</html>